package com.wdz.mvr.controllers;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.wdz.mvr.dao.ActorRepository;
//import com.wdz.mvr.dao.ClassificationRepository;
import com.wdz.mvr.dao.MovieRepository;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;


@Controller
    public class HomeController {

//        @Value("${version}")
//        private String version;

        @Autowired
        ActorRepository actorRepository;

        @Autowired
        MovieRepository movieRepository;

//        @Autowired
//        ClassificationRepository classificationRepository;

//
//    @GetMapping("/")
//    public String displayHomeRegister(){
//
//        return "/security/register";
//    }

        @GetMapping("/")
        public String displayHome(Model model) throws JsonProcessingException {

//////            List<Actor> actors = actorRepository.findAll();
//////            model.addAttribute("actors",actors);
//////
//////            List<ChartData> projectStatusData = actorRepository.getProjectStatus();
////            //转换projectStatusData为JSON结构，方便在JS脚本中使用
//////            ObjectMapper objectMapper= new ObjectMapper();
//////            String jsonString = objectMapper.writeValueAsString(projectStatusData);
////            //[{"未开始",1},{"进行中",2},{"已完成",1}]
//////            model.addAttribute("projectStatusData",jsonString);
////
//////            List<StudentProject> studentProjects = studentRepository.studentProjects();
//////            model.addAttribute("studentProjects",studentProjects);
////
            return "main/home";
//
        }

    }
